We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to insert Css, Javascript to <head> tag html in Phalcon

Hi Phalcon, I've worked with Yii framework. In Yii, I can call at any place and it is always placed at the beginning of the <title> tag: Yii :: app () -> clientScript-> registerCssFile ( 'product.css');

Is result: <head> <link href="product.css" rel="stylesheet"> <title></title> </head>

In phalcon can do this? Pelase help me

Yes sir, thank Oleg for support. How to use this in view file

// Add some local CSS resources $this->assets ->addCss('css/style.css') ->addCss('css/index.css');

    // And some local JavaScript resources
    $this->assets
        ->addJs('js/jquery.js')
        ->addJs('js/bootstrap.min.js');


58.4k

Why use this in views while we have use in controller, if you want to this just{{this.assets.addJs())}}

Use it in controller/some config file, and then in volt:

{{assets.outputJs/Css()}} will output all css/js files